﻿<CustomWindow:EssentialWindow x:Class="SteamGroupPlayers.View.MainWindow"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
		xmlns:tk="http://schemas.microsoft.com/wpf/2008/toolkit" 
		xmlns:tkx="http://schemas.xceed.com/wpf/xaml/toolkit" 
		xmlns:util="clr-namespace:SteamGroupPlayers.Utilities"
		xmlns:conv="clr-namespace:SteamGroupPlayers.Utilities.Converters" 
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
		xmlns:mdl="clr-namespace:SteamGroupPlayers.Model"
		xmlns:view="clr-namespace:SteamGroupPlayers.View"
		xmlns:vm="clr-namespace:SteamGroupPlayers.ViewModel"
		xmlns:CustomWindow="clr-namespace:CustomWindow;assembly=CustomWindow"
		AllowsTransparency="True" Background="Transparent"
		mc:Ignorable="d" 
		Height="300"
		Width="840"
		MaxWidth="840"
		Title="Group Players" Icon="Skins/steam48.png">
	
	<Window.Resources>
		<ResourceDictionary>
			
			<!-- SKINS -->
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="Skins/MainSkin.xaml" />
			</ResourceDictionary.MergedDictionaries>
			
			<!-- CONVERTERS -->
			<conv:BoolToBrushConverter x:Key="backgroundConverter"
									   TrueValue="DarkRed"
									   FalseValue="{StaticResource steamBG2}"/>
			<conv:BoolToDoubleConverter x:Key="opacityConverter"
										TrueValue="1.0"
										FalseValue="0.25"/>
			<conv:BoolToVisibilityConverter x:Key="exceptionVisibility"
											TrueValue="Visible"
											FalseValue="Hidden"/>
			<conv:ValueConverterGroup x:Key="playerlistItemConverter">
				<conv:HasItemsToBoolConverter/>
				<conv:BoolToStringConverter TrueValue=" Players"
											FalseValue=""/>
			</conv:ValueConverterGroup>
			
			<!-- VIEWMODEL -->
			<vm:GroupViewModel x:Key="viewModel"/>
			
		</ResourceDictionary>
	</Window.Resources>

	<Grid x:Name="win" Background="Transparent" DataContext="{StaticResource viewModel}">
		<Border x:Name="dirtyBgFix" Background="{StaticResource steamBG2}" CornerRadius="12"/>
		<Border x:Name="winBG" Background="{StaticResource steamBGGrad}" CornerRadius="10" BorderBrush="{StaticResource steamBG2}" BorderThickness="5"/>
		<Border x:Name="winInnerBorder" Background="Transparent" CornerRadius="10" BorderBrush="{StaticResource steamFG}" BorderThickness="2"/>
		<Border x:Name="winTop" MouseMove="Border_MouseMove" MouseLeftButtonDown="Border_MouseLeftButtonDown" VerticalAlignment="Top" Background="{StaticResource steamBGGrad2}" CornerRadius="10,10,5,5" Height="75"/>

		<Grid x:Name="winContent" Margin="5,25,5,5">
			<tkx:BusyIndicator IsBusy="{Binding IsBusy, UpdateSourceTrigger=PropertyChanged}"
							   BusyContent="Loading . . .">
				<tkx:BusyIndicator.ProgressBarStyle>
					<Style TargetType="{x:Type ProgressBar}">
						<Setter Property="IsIndeterminate" Value="{Binding IsIndeterminate}"/>
						<Setter Property="Height" Value="15"/>
						<Setter Property="Margin" Value="8,0,8,8"/>
						<Setter Property="Minimum" Value="0"/>
						<Setter Property="Maximum" Value="1"/>
						<Setter Property="Value" Value="{Binding Progress}"/>
						<Setter Property="Template">
							<Setter.Value>
								<ControlTemplate TargetType="{x:Type ProgressBar}">
									<ControlTemplate.Resources>
										<Storyboard x:Key="OnLoaded1" RepeatBehavior="Forever" >
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Offset)" Storyboard.TargetName="border">
												<EasingDoubleKeyFrame KeyTime="0" Value="-0.2"/>
												<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.4"/>
												<EasingDoubleKeyFrame KeyTime="0:0:2" Value="1"/>
											</DoubleAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Offset)" Storyboard.TargetName="border">
												<EasingDoubleKeyFrame KeyTime="0" Value="-0.1"/>
												<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.5"/>
												<EasingDoubleKeyFrame KeyTime="0:0:2" Value="1.1"/>
											</DoubleAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[2].(GradientStop.Offset)" Storyboard.TargetName="border">
												<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
												<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.6"/>
												<EasingDoubleKeyFrame KeyTime="0:0:2" Value="1.2"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>
									</ControlTemplate.Resources>
									<Grid x:Name="grid" SnapsToDevicePixels="True">
										<Border Background="{StaticResource steamBG}" CornerRadius="5" Opacity="0.75"
										BorderBrush="{StaticResource steamBG2}" BorderThickness="1"/>
										<Border x:Name="border" CornerRadius="5" Margin="2" BorderBrush="Black" BorderThickness="1">
											<Border.Background>
												<LinearGradientBrush EndPoint="1,2" StartPoint="0,0">
													<GradientStop Offset="-0.2" Color="#00000000"/>
													<GradientStop Color="Black" Offset="-0.1"/>
													<GradientStop Color="#00000000" Offset="0"/>
												</LinearGradientBrush>
											</Border.Background>
										</Border>
										<Border x:Name="progressBorder" CornerRadius="5" Margin="2" BorderBrush="Black" BorderThickness="1">
											<Border.Background>
												<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
													<GradientStop Offset="0" Color="Black"/>
													<GradientStop Offset="{Binding Progress, UpdateSourceTrigger=PropertyChanged}" Color="Black"/>
													<GradientStop Offset="1" Color="Transparent"/>
												</LinearGradientBrush>
											</Border.Background>
										</Border>
									</Grid>
									<ControlTemplate.Triggers>
										<Trigger Property="IsIndeterminate" Value="True">
											<Trigger.EnterActions>
												<BeginStoryboard x:Name="OnLoaded1_BeginStoryboard" Storyboard="{StaticResource OnLoaded1}"/>
											</Trigger.EnterActions>
											<Trigger.Setters>
												<Setter TargetName="progressBorder" Property="Border.Visibility" Value="Hidden"/>
												<Setter TargetName="border" Property="Border.Visibility" Value="Visible"/>
											</Trigger.Setters>
										</Trigger>
										<Trigger Property="IsIndeterminate" Value="False">
											<Trigger.Setters>
												<Setter TargetName="progressBorder" Property="Border.Visibility" Value="Visible"/>
												<Setter TargetName="border" Property="Border.Visibility" Value="Hidden"/>
											</Trigger.Setters>
										</Trigger>
									</ControlTemplate.Triggers>
								</ControlTemplate>
							</Setter.Value>
						</Setter>
					</Style>
				</tkx:BusyIndicator.ProgressBarStyle>
				<Grid x:Name="LayoutRoot" Background="Transparent">
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto"/>
						<RowDefinition/>
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto"/>
						<ColumnDefinition/>
					</Grid.ColumnDefinitions>

					<Border Grid.ColumnSpan="2" Background="Transparent" Height="50">
						<Grid Margin="5">
							<Grid.RowDefinitions>
								<RowDefinition/>
								<RowDefinition/>
							</Grid.RowDefinitions>
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="200" />
								<ColumnDefinition Width="60"/>
								<ColumnDefinition/>
							</Grid.ColumnDefinitions>

							<TextBlock Foreground="{StaticResource steamTxtPrimary}">Group abbreviation:</TextBlock>
							<TextBox x:Name="groupInput" Grid.Row="1" Style="{DynamicResource groupTB}">
								<TextBox.InputBindings>
									<KeyBinding Command="{Binding SetGroupCommand}"
												CommandParameter="{Binding Text, ElementName=groupInput}"
												Key="Enter"/>
								</TextBox.InputBindings>
							</TextBox>

							<Button Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" Command="{Binding SetGroupCommand}" CommandParameter="{Binding Text, ElementName=groupInput}" Content="Load" Margin="0,0,15,0" Width="30" Style="{DynamicResource steamLoadBtn}" />
							<Button Grid.RowSpan="2" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="24" Height="24" 
									Command="{Binding CopyExceptionsCommand}"
									Visibility="{Binding HasExceptions, Converter={StaticResource exceptionVisibility}, UpdateSourceTrigger=PropertyChanged}">
								<ToolTipService.ToolTip>
									<StackPanel>
										<TextBlock>Click Icon to copy errors to your clipboard</TextBlock>
										<ListBox ItemsSource="{Binding Exceptions}" DisplayMemberPath="Item3.Message" Background="{StaticResource steamFG}" Foreground="{StaticResource steamTxtPrimary}"/>
									</StackPanel>
								</ToolTipService.ToolTip>
								<Button.Template>
									<ControlTemplate>
										<Image Height="24" Source="{Binding Warning}"/>
									</ControlTemplate>
								</Button.Template>
							</Button>

							<TextBlock Grid.Column="2" HorizontalAlignment="Center" Margin="150,0,165,0" Foreground="{StaticResource steamTxtPrimary}">Order by:</TextBlock>
							<Border Grid.Column="2" Grid.Row="1" Background="{StaticResource steamBG}" CornerRadius="5" Grid.ColumnSpan="2" Margin="31,0,0,0"
									BorderBrush="{StaticResource steamFG}" BorderThickness="2" AllowDrop="True" Drop="dropTarget_Drop" DragEnter="dropTarget_DragEnter">
								<Grid>
									<TextBlock Grid.Row="1" Grid.Column="2" Foreground="{StaticResource steamTxtSecondary}" Text="None" VerticalAlignment="Center" HorizontalAlignment="Center">
										<TextBlock.Style>
											<Style>
												<Style.Triggers>
													<DataTrigger Binding="{Binding FilterGame, Converter={conv:IsNullToBoolConverter}, UpdateSourceTrigger=PropertyChanged}" Value="True">
														<Setter Property="TextBlock.Visibility" Value="Visible"/>
													</DataTrigger> 
													<DataTrigger Binding="{Binding FilterGame, Converter={conv:IsNullToBoolConverter}, UpdateSourceTrigger=PropertyChanged}" Value="False">
														<Setter Property="TextBlock.Visibility" Value="Hidden"/>
													</DataTrigger>  
												</Style.Triggers>
											</Style>
										</TextBlock.Style>
									</TextBlock>
									<Border Grid.Row="1" Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" Background="{StaticResource steamFG}"
											BorderBrush="{StaticResource steamTxtSecondary}" BorderThickness="1">
										<Border.Style>
											<Style>
												<Style.Triggers>
													<DataTrigger Binding="{Binding FilterGame, Converter={conv:IsNullToBoolConverter}, UpdateSourceTrigger=PropertyChanged}" Value="False">
														<Setter Property="Border.Visibility" Value="Visible"/>
													</DataTrigger>
													<DataTrigger Binding="{Binding FilterGame, Converter={conv:IsNullToBoolConverter}, UpdateSourceTrigger=PropertyChanged}" Value="True">
														<Setter Property="Border.Visibility" Value="Hidden"/>
													</DataTrigger>
												</Style.Triggers>
											</Style>
										</Border.Style>
										
										<StackPanel Orientation="Horizontal">
											<TextBlock Text="{Binding FilterGame.Name}" Foreground="{StaticResource steamTxtPrimary}" FontStyle="Italic" Margin="5,0,2,0" />
											<Button x:Name="btn_unfilter" Margin="2,0,0,0" Click="btn_unfilter_Click">
												<Button.Template>
													<ControlTemplate>
														<Image x:Name="imgClose" Source="/SteamGroupPlayers;component/View/Skins/win32_win_close.png" />
														<ControlTemplate.Triggers>
															<Trigger Property="IsMouseOver" Value="True">
																<Setter Property="Source" TargetName="imgClose" Value="Skins/win32_win_close_hover.png"/>
															</Trigger>
															<Trigger Property="IsMouseOver" Value="False">
																<Setter Property="Source" TargetName="imgClose" Value="Skins/win32_win_close.png"/>
															</Trigger>
														</ControlTemplate.Triggers>
													</ControlTemplate>
												</Button.Template>
											</Button>
										</StackPanel>
									</Border>

									<ComboBox Width="20" HorizontalAlignment="Left" Margin="5,0,0,0" ItemsSource="{Binding GameList}" Style="{DynamicResource gamesComboBox}"
											  SelectionChanged="ComboBox_SelectionChanged" IsEnabled="{Binding GameListEnabled}"/>
									<Grid HorizontalAlignment="Right">
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="Auto"/>
											<ColumnDefinition Width="Auto"/>
										</Grid.ColumnDefinitions>
										
										<Border Grid.ColumnSpan="2" CornerRadius="5" Background="{StaticResource steamBG2}" VerticalAlignment="Stretch" BorderBrush="{StaticResource steamFG}" BorderThickness="1"/>
										<CheckBox Grid.Column="0" IsChecked="{Binding Recent}" VerticalAlignment="Center" Margin="5,0,0,0"/>
										<TextBlock Grid.Column="1" Text="Recent" Foreground="{StaticResource steamTxtPrimary}" VerticalAlignment="Center" Margin="2,0,5,0"/>
									</Grid>
									<!--<Border HorizontalAlignment="Right" CornerRadius="2" Background="{StaticResource steamBG2}">
										<Grid>
											<TextBlock Text="Recent: "/>
										</Grid>
									</Border>
									<CheckBox Content="Recent" HorizontalAlignment="Right" IsChecked="{Binding Recent}"/>-->
								</Grid>
							</Border>
						</Grid>
					</Border>

					<Grid Grid.Row="1">
						<Grid.RowDefinitions>
							<RowDefinition Height="75"/>
							<RowDefinition/>
						</Grid.RowDefinitions>

						<Border Background="{StaticResource steamBG2}" CornerRadius="0,0,10,10">
							<Grid Margin="5">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="Auto"/>
									<ColumnDefinition/>
								</Grid.ColumnDefinitions>

								<Image Margin="5" Height="48" Width="48" Source="{Binding GroupAvatar, UpdateSourceTrigger=PropertyChanged}"/>

								<StackPanel Grid.Column="1">
									<TextBlock Foreground="{StaticResource steamTxtSecondary}" FontWeight="Bold" Opacity="0.75">Steam Group</TextBlock>
									<TextBlock Foreground="{StaticResource steamTxtPrimary}" Text="{Binding GroupName, UpdateSourceTrigger=PropertyChanged}" FontWeight="Bold"/>
									<ProgressBar Grid.Column="1" VerticalAlignment="Bottom" Height="10" Maximum="{Binding PlayersToLoad}" Value="{Binding LoadedPlayers}" Style="{DynamicResource GroupProgress}" Width="200" Margin="0,5,0,0">
										<ToolTipService.ToolTip>
											<StackPanel Orientation="Horizontal">
												<TextBlock Text="{Binding LoadedPlayers}"/>
												<TextBlock Text=" / "/>
												<TextBlock Text="{Binding PlayersToLoad}"/>
											</StackPanel>
										</ToolTipService.ToolTip>
									</ProgressBar>
									<!--<ProgressBar Grid.Column="1" VerticalAlignment="Bottom" Height="10" Maximum="100" Value="50" Style="{DynamicResource GroupProgress}" />-->
								</StackPanel>

								<StackPanel Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal">
									<TextBlock FontSize="9" Foreground="{StaticResource steamTxtPrimary}" Text="{Binding PlayerList.Count, UpdateSourceTrigger=PropertyChanged}"/>
									<TextBlock FontSize="9" Foreground="{StaticResource steamTxtPrimary}" Text="{Binding PlayerList, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource playerlistItemConverter}}"/>
								</StackPanel>
							</Grid>
						</Border>

						<view:SteamListBox x:Name="lbGroup" Grid.Row="1" Width="280" ItemsSource="{Binding PlayerList, UpdateSourceTrigger=PropertyChanged}" Background="Transparent"
								  ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
							<view:SteamListBox.ItemTemplate>
								<DataTemplate>
									<Grid Margin="2" MaxHeight="56" Width="250">
										<Border CornerRadius="5" Background="{Binding IsCorrupted, Converter={StaticResource backgroundConverter}, UpdateSourceTrigger=PropertyChanged}" Width="Auto"
											Opacity="{Binding Public, Converter={StaticResource opacityConverter}, UpdateSourceTrigger=PropertyChanged}">
											<Grid Margin="5">
												<Grid.ColumnDefinitions>
													<ColumnDefinition Width="Auto"/>
													<ColumnDefinition/>
												</Grid.ColumnDefinitions>

												<Border Grid.Column="0" CornerRadius="5">
													<Border.Style>
														<Style>
															<Style.Triggers>
																<DataTrigger Binding="{Binding State, UpdateSourceTrigger=PropertyChanged}" Value="offline">
																	<Setter Property="Border.Background" Value="{StaticResource steamTxtPrimary}"/>
																</DataTrigger>
																<DataTrigger Binding="{Binding State, UpdateSourceTrigger=PropertyChanged}" Value="online">
																	<Setter Property="Border.Background" Value="{StaticResource steamTxtOnline}"/>
																</DataTrigger>
																<DataTrigger Binding="{Binding State, UpdateSourceTrigger=PropertyChanged}" Value="in-game">
																	<Setter Property="Border.Background" Value="{StaticResource steamTxtInGame}"/>
																</DataTrigger>
															</Style.Triggers>
														</Style>
													</Border.Style>
													<Grid Width="40" Margin="3">
														<Border x:Name="avatarMask" Background="{StaticResource steamBG2}" CornerRadius="5"/>
														<Image Source="{Binding AvatarIcon, UpdateSourceTrigger=PropertyChanged}">
															<Image.OpacityMask>
																<VisualBrush Visual="{Binding ElementName=avatarMask}"/>
															</Image.OpacityMask>
														</Image>
													</Grid>
												</Border>
												<Grid Grid.Column="1">
													<Grid.RowDefinitions>
														<RowDefinition Height="Auto"/>
														<RowDefinition/>
													</Grid.RowDefinitions>

													<TextBlock Grid.Row="0" Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" Margin="2,0" FontWeight="Bold" FontSize="12">
												<TextBlock.Style>
													<Style>
														<Style.Triggers>
															<DataTrigger Binding="{Binding State, UpdateSourceTrigger=PropertyChanged}" Value="offline">
															<Setter Property="TextBlock.Foreground" Value="{StaticResource steamTxtPrimary}"/>
															</DataTrigger>
															<DataTrigger Binding="{Binding State, UpdateSourceTrigger=PropertyChanged}" Value="online">
																<Setter Property="TextBlock.Foreground" Value="{StaticResource steamTxtOnline}"/>
															</DataTrigger>
															<DataTrigger Binding="{Binding State, UpdateSourceTrigger=PropertyChanged}" Value="in-game">
																<Setter Property="TextBlock.Foreground" Value="{StaticResource steamTxtInGame}"/>
															</DataTrigger>
														</Style.Triggers>
													</Style>
												</TextBlock.Style>
													</TextBlock>

													<TextBlock Grid.Row="1" Margin="2,0" Text="{Binding StateMessage, UpdateSourceTrigger=PropertyChanged}">
												<TextBlock.Style>
													<Style>
														<Style.Triggers>
															<DataTrigger Binding="{Binding State, UpdateSourceTrigger=PropertyChanged}" Value="offline">
															<Setter Property="TextBlock.Foreground" Value="{StaticResource steamTxtPrimary}"/>
															</DataTrigger>
															<DataTrigger Binding="{Binding State, UpdateSourceTrigger=PropertyChanged}" Value="online">
																<Setter Property="TextBlock.Foreground" Value="{StaticResource steamTxtOnline}"/>
															</DataTrigger>
															<DataTrigger Binding="{Binding State, UpdateSourceTrigger=PropertyChanged}" Value="in-game">
																<Setter Property="TextBlock.Foreground" Value="{StaticResource steamTxtInGame}"/>
															</DataTrigger>
														</Style.Triggers>
													</Style>
												</TextBlock.Style>
													</TextBlock>
												</Grid>
												<tkx:BusyIndicator Grid.ColumnSpan="2" HorizontalAlignment="Center" IsBusy="{Binding IsLoading, UpdateSourceTrigger=PropertyChanged}" BusyContent="Loading . . ." MaxHeight="75"/>
											</Grid>
										</Border>
									</Grid>
								</DataTemplate>
							</view:SteamListBox.ItemTemplate>
						</view:SteamListBox>
					</Grid>

					<tkx:BusyIndicator Grid.Row="1" Grid.Column="1" IsBusy="{Binding SelectedItem.IsLoading, ElementName=lbGroup}" BusyContent="Loading . . .">
						<Grid>
							<Grid.RowDefinitions>
								<RowDefinition Height="75"/>
								<RowDefinition/>
							</Grid.RowDefinitions>

							<Border CornerRadius="0,0,10,10" Background="{StaticResource steamBG2}">
								<Grid Margin="5">
									<Grid.ColumnDefinitions>
										<ColumnDefinition Width="Auto"/>
										<ColumnDefinition/>
									</Grid.ColumnDefinitions>

									<Border Grid.Column="0" CornerRadius="10" Width="60" Height="60">
										<Border.Style>
											<Style>
												<Style.Triggers>
													<DataTrigger Binding="{Binding SelectedItem.State, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}" Value="offline">
														<Setter Property="Border.Background" Value="{StaticResource steamTxtPrimary}"/>
													</DataTrigger>
													<DataTrigger Binding="{Binding SelectedItem.State, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}" Value="online">
														<Setter Property="Border.Background" Value="{StaticResource steamTxtOnline}"/>
													</DataTrigger>
													<DataTrigger Binding="{Binding SelectedItem.State, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}" Value="in-game">
														<Setter Property="Border.Background" Value="{StaticResource steamTxtInGame}"/>
													</DataTrigger>
												</Style.Triggers>
											</Style>
										</Border.Style>

										<Grid Margin="3">
											<Border x:Name="imgMask" Background="{StaticResource steamBG2}" CornerRadius="10"/>
											<Image Source="{Binding SelectedItem.AvatarMedium, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}">
												<Image.OpacityMask>
													<VisualBrush Visual="{Binding ElementName=imgMask}"/>
												</Image.OpacityMask>
											</Image>
										</Grid>
									</Border>
									<Grid Grid.Column="1" Margin="5">
										<StackPanel>
											<TextBlock FontSize="14" FontWeight="Bold">
												<TextBlock.Style>
													<Style>
														<Style.Triggers>
															<DataTrigger Binding="{Binding SelectedItem, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}" Value="{x:Null}">
																<Setter Property="TextBlock.Visibility" Value="Hidden"/>
															</DataTrigger>
														</Style.Triggers>
													</Style>
												</TextBlock.Style>
												<Hyperlink x:Name="link" NavigateUri="{Binding SelectedItem.CommunityURL, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}" util:HyperlinkUtility.LaunchDefaultBrowser="True">
													<ToolTipService.ToolTip>
														<TextBlock Text="Open Steam Community Profile"/>
													</ToolTipService.ToolTip>
													<TextBlock Text="{Binding SelectedItem.Name, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}">
														<TextBlock.Style>
															<Style>
																<Style.Triggers>
																	<DataTrigger Binding="{Binding SelectedItem.State, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}" Value="offline">
																	<Setter Property="TextBlock.Foreground" Value="{StaticResource steamTxtPrimary}"/>
																	</DataTrigger>
																	<DataTrigger Binding="{Binding SelectedItem.State, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}" Value="online">
																		<Setter Property="TextBlock.Foreground" Value="{StaticResource steamTxtOnline}"/>
																	</DataTrigger>
																	<DataTrigger Binding="{Binding SelectedItem.State, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}" Value="in-game">
																		<Setter Property="TextBlock.Foreground" Value="{StaticResource steamTxtInGame}"/>
																	</DataTrigger>
																</Style.Triggers>
															</Style>
														</TextBlock.Style>
														</TextBlock>
												</Hyperlink>
												<Image Height="{Binding ElementName=link, Path=FontSize}" Source="/SteamGroupPlayers;component/View/Skins/link.png" />
											</TextBlock>
											<TextBlock Text="{Binding SelectedItem.StateMessage, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}">
												<TextBlock.Style>
													<Style>
														<Style.Triggers>
															<DataTrigger Binding="{Binding SelectedItem.State, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}" Value="offline">
															<Setter Property="TextBlock.Foreground" Value="{StaticResource steamTxtPrimary}"/>
															</DataTrigger>
															<DataTrigger Binding="{Binding SelectedItem.State, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}" Value="online">
																<Setter Property="TextBlock.Foreground" Value="{StaticResource steamTxtOnline}"/>
															</DataTrigger>
															<DataTrigger Binding="{Binding SelectedItem.State, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}" Value="in-game">
																<Setter Property="TextBlock.Foreground" Value="{StaticResource steamTxtInGame}"/>
															</DataTrigger>
														</Style.Triggers>
													</Style>
												</TextBlock.Style>
											</TextBlock>
										</StackPanel>
										
										<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom">
											<StackPanel.Style>
												<Style>
													<Style.Triggers>
														<DataTrigger Binding="{Binding SelectedItem, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}" Value="{x:Null}">
															<Setter Property="StackPanel.Visibility" Value="Hidden"/>
														</DataTrigger>
													</Style.Triggers>
												</Style>
											</StackPanel.Style>

											<TextBlock Foreground="{DynamicResource steamTxtPrimary}" Text="{Binding SelectedItem.SumRecent, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}"/>
											<TextBlock Foreground="{DynamicResource steamTxtPrimary}" Text=" / "/>
											<TextBlock Foreground="{DynamicResource steamTxtPrimary}" Text="{Binding SelectedItem.SumAll, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}"/>
										</StackPanel>
									</Grid>
								</Grid>
							</Border>

							<view:SteamListBox Grid.Row="1" ItemsSource="{Binding SelectedItem.Played, ElementName=lbGroup, UpdateSourceTrigger=PropertyChanged}" Background="Transparent" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
											   PreviewMouseLeftButtonDown="SteamListBox_PreviewMouseLeftButtonDown" MouseMove="SteamListBox_MouseMove">
								<view:SteamListBox.ItemTemplate>
									<DataTemplate>
										<Grid Width="510" Height="85" Margin="5">
											<Border CornerRadius="5" Background="{StaticResource steamBG2}">
												<Grid Margin="5">
													<Grid.ColumnDefinitions>
														<ColumnDefinition Width="200"/>
														<ColumnDefinition/>
													</Grid.ColumnDefinitions>

													<Border HorizontalAlignment="Left" x:Name="gameMask" Background="{StaticResource steamBG2}" Width="175" Height="65" CornerRadius="5"/>
													<Image Source="{Binding Logo}" HorizontalAlignment="Left" Width="175" Height="65">
														<Image.OpacityMask>
															<VisualBrush Visual="{Binding ElementName=gameMask}"/>
														</Image.OpacityMask>
														<Image.Effect>
															<DropShadowEffect/>
														</Image.Effect>
													</Image>

													<Grid Grid.Column="1" Margin="5">
														<Grid.RowDefinitions>
															<RowDefinition/>
															<RowDefinition/>
														</Grid.RowDefinitions>

														<TextBlock Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" FontSize="14" FontWeight="Bold" Foreground="{StaticResource steamTxtPrimary}" />
														<StackPanel Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal">
															<TextBlock Text="{Binding PlayedRecent, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{StaticResource steamTxtPrimary}"/>
															<TextBlock Text=" / " FontSize="14" Foreground="{StaticResource steamTxtPrimary}"/>
															<TextBlock Text="{Binding PlayedAll, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{StaticResource steamTxtPrimary}"/>
														</StackPanel>
														<TextBlock Grid.Row="1" VerticalAlignment="Center" Foreground="{StaticResource steamTxtOnline}">
												<ToolTipService.ToolTip>
													<TextBlock Text="{Binding StoreLink, UpdateSourceTrigger=PropertyChanged}"/>
												</ToolTipService.ToolTip>
												<Hyperlink x:Name="link" NavigateUri="{Binding StoreLink, UpdateSourceTrigger=PropertyChanged}" util:HyperlinkUtility.LaunchDefaultBrowser="True" Foreground="{StaticResource steamTxtOnline}">Store Page</Hyperlink>
												<Image Height="{Binding ElementName=link, Path=FontSize}" Source="/SteamGroupPlayers;component/View/Skins/link.png" />
											</TextBlock>
													</Grid>
												</Grid>
											</Border>
										</Grid>
									</DataTemplate>
								</view:SteamListBox.ItemTemplate>
							</view:SteamListBox>
						</Grid>
					</tkx:BusyIndicator>
				</Grid>
			</tkx:BusyIndicator>
		</Grid>

		<Image HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,5,0,0" Source="Skins/steam48.png" Height="20"/>
		<TextBlock MouseMove="Border_MouseMove" MouseLeftButtonDown="Border_MouseLeftButtonDown" FontSize="14" FontWeight="Bold" Foreground="{StaticResource steamTxtPrimary}" HorizontalAlignment="Center" VerticalAlignment="Top" Text="Steam Group Players" Margin="0,5,0,0"/>
		<Border Name="WindowButtonsPlaceholder" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-1,10,0" Visibility="Hidden"/>
		<Border Background="{StaticResource steamBG2}" HorizontalAlignment="Right" VerticalAlignment="Top" CornerRadius="5,10,5,5" Width="60" Height="18"
				BorderBrush="{StaticResource steamTxtSecondary}" BorderThickness="1,0,0,1"/>
		<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,1,0,0">
			<Button x:Name="btn_min" Margin="2,0" Click="btn_min_Click">
				<Button.Template>
					<ControlTemplate>
						<Image x:Name="imgMin" Height="16" Width="16" Source="/SteamGroupPlayers;component/View/Skins/win32_win_min.png">
						</Image>
						<ControlTemplate.Triggers>
							<Trigger Property="IsMouseOver" Value="True">
								<Setter Property="Source" TargetName="imgMin" Value="Skins/win32_win_min_hover.png"/>
							</Trigger>
							<Trigger Property="IsMouseOver" Value="False">
								<Setter Property="Source" TargetName="imgMin" Value="Skins/win32_win_min.png"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Button.Template>
			</Button>
			<Button x:Name="btn_max" Margin="2,0" Click="btn_max_Click">
				<Button.Template>
					<ControlTemplate>
						<Image x:Name="imgMax" Height="16" Width="16" Source="/SteamGroupPlayers;component/View/Skins/win32_win_max.png"/>
						<ControlTemplate.Triggers>
							<MultiDataTrigger>
								<MultiDataTrigger.Conditions>
									<Condition Binding="{Binding ElementName=btn_max, Path=IsMouseOver}" Value="False"/>
									<Condition Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=WindowState}" Value="Normal"/>
								</MultiDataTrigger.Conditions>
								<Setter Property="Source" TargetName="imgMax" Value="Skins/win32_win_max.png"/>
							</MultiDataTrigger>
							<MultiDataTrigger>
								<MultiDataTrigger.Conditions>
									<Condition Binding="{Binding ElementName=btn_max, Path=IsMouseOver}" Value="True"/>
									<Condition Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=WindowState}" Value="Normal"/>
								</MultiDataTrigger.Conditions>
								<Setter Property="Source" TargetName="imgMax" Value="Skins/win32_win_max_hover.png"/>
							</MultiDataTrigger>
							<MultiDataTrigger>
								<MultiDataTrigger.Conditions>
									<Condition Binding="{Binding ElementName=btn_max, Path=IsMouseOver}" Value="False"/>
									<Condition Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=WindowState}" Value="Maximized"/>
								</MultiDataTrigger.Conditions>
								<Setter Property="Source" TargetName="imgMax" Value="Skins/win32_win_restore.png"/>
							</MultiDataTrigger>
							<MultiDataTrigger>
								<MultiDataTrigger.Conditions>
									<Condition Binding="{Binding ElementName=btn_max, Path=IsMouseOver}" Value="True"/>
									<Condition Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=WindowState}" Value="Maximized"/>
								</MultiDataTrigger.Conditions>
								<Setter Property="Source" TargetName="imgMax" Value="Skins/win32_win_restore_hover.png"/>
							</MultiDataTrigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Button.Template>
			</Button>
			<Button x:Name="btn_close" Margin="2,0" Click="btn_close_Click">
				<Button.Template>
					<ControlTemplate>
						<Image x:Name="imgClose" Height="16" Width="16" Source="/SteamGroupPlayers;component/View/Skins/win32_win_close.png" />
						<ControlTemplate.Triggers>
							<Trigger Property="IsMouseOver" Value="True">
								<Setter Property="Source" TargetName="imgClose" Value="Skins/win32_win_close_hover.png"/>
							</Trigger>
							<Trigger Property="IsMouseOver" Value="False">
								<Setter Property="Source" TargetName="imgClose" Value="Skins/win32_win_close.png"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Button.Template>
			</Button>
		</StackPanel>
		<Thumb DragDelta="Thumb_DragDelta" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Cursor="SizeNS" Opacity="0"/>
	</Grid>
</CustomWindow:EssentialWindow>
